package com.test.ai.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.ai.openai.OpenAiChatModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created with IntelliJ IDEA.
 *
 * @description:
 * @author: liuziyang
 * @since: 2025/8/13 11:10
 * @modifiedBy:
 * @version: 1.0
 */
@Slf4j
@RestController
class ChetQwenController {
  @Autowired private OpenAiChatModel chatModel;

  @GetMapping("/ai/generate")
  public String generate(
      @RequestParam(value = "message", defaultValue = "介绍一下你自己") String message) {
    String response = chatModel.call(message);
    log.info("ChetQwen response: {}", response);
    return response;
  }
}
